﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models {
    import net.wooga.pets.models.vo.*;
    import org.robotlegs.mvcs.*;

    public class AchievementModel extends Actor {

        private var _curedPets:int;
        private var _collectedHiddenBirds:int;
        private var _usedBoost:int;
        private var _collectedGems:int;
        private var _curedElders:int;
        private var _usedCoffees:int;
        private var _achievements:Array;
        private var _collectedRewardIDs:Array;

        public static const CURED_PETS:String = "cured_pets";
        public static const CURED_ELDERS:String = "helped_elders";
        public static const COLLECTED_BIRDS:String = "collected_birds";
        public static const COLLECTED_GEMS:String = "collected_gems";
        public static const USED_BOOSTS:String = "used_boosts";
        public static const SERVED_COFFEES:String = "served_coffees";

        public function AchievementModel(){
            this._achievements = [];
            super();
        }
        public function addAchievement(_arg1:AchievementVO):void{
            this._achievements.push(_arg1);
        }
        public function get curedPets():int{
            return (this._curedPets);
        }
        public function set curedPets(_arg1:int):void{
            this._curedPets = _arg1;
        }
        public function get collectedHiddenBirds():int{
            return (this._collectedHiddenBirds);
        }
        public function set collectedHiddenBirds(_arg1:int):void{
            this._collectedHiddenBirds = _arg1;
        }
        public function get usedBoost():int{
            return (this._usedBoost);
        }
        public function set usedBoost(_arg1:int):void{
            this._usedBoost = _arg1;
        }
        public function get collectedGems():int{
            return (this._collectedGems);
        }
        public function set collectedGems(_arg1:int):void{
            this._collectedGems = _arg1;
        }
        public function get curedElders():int{
            return (this._curedElders);
        }
        public function set curedElders(_arg1:int):void{
            this._curedElders = _arg1;
        }
        public function get usedCoffees():int{
            return (this._usedCoffees);
        }
        public function set usedCoffees(_arg1:int):void{
            this._usedCoffees = _arg1;
        }
        public function get achievements():Array{
            return (this._achievements);
        }
        public function getAchievementByID(_arg1:String):AchievementVO{
            var _local2:AchievementVO;
            for each (_local2 in this.achievements) {
                if (_local2.id == _arg1){
                    return (_local2);
                };
            };
            return (null);
        }
        public function set collectedRewardIDs(_arg1:Array):void{
            this._collectedRewardIDs = _arg1;
        }
        public function get collectedRewardIDs():Array{
            return (this._collectedRewardIDs);
        }
        public function getAllRewards():Array{
            var _local2:AchievementVO;
            var _local3:RewardVO;
            var _local1:Array = [];
            for each (_local2 in this.achievements) {
                for each (_local3 in _local2.rewards) {
                    _local1.push(_local3);
                };
            };
            return (_local1);
        }
        public function getNumberOfNotCollectedReachedRewards():int{
            var _local2:AchievementVO;
            var _local1:int;
            for each (_local2 in this._achievements) {
                _local1 = (_local1 + _local2.getNotCollectedReachedRewards().length);
            };
            return (_local1);
        }
        public function getRewardById(_arg1:String):RewardVO{
            var _local2:RewardVO;
            for each (_local2 in this.getAllRewards()) {
                if (_local2.id == _arg1){
                    return (_local2);
                };
            };
            l(("e no rewardVO found with id: " + _arg1));
            return (null);
        }

    }
}//package net.wooga.pets.models 
